﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BAITAPNGAY13_5
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        HOADON hoadon = new HOADON();
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            DataTable DT = hoadon.DanhSachHoaDon();
            datagrid.ItemsSource = DT.DefaultView;
            datagrid.SelectedValuePath = "sohd";
        }

        private void mnxoa_Click_1(object sender, RoutedEventArgs e)
        {
            string shd = datagrid.SelectedValue.ToString();
            hoadon.XOAHOADON(shd);
            DataRowView rowSelect = (DataRowView)datagrid.SelectedItem;
            rowSelect.Delete();
            MessageBoxResult result = MessageBox.Show(" bạn có muốn xóa hóa đơn ....không?", "thông báo", MessageBoxButton.YesNo, MessageBoxImage.Warning);
            if (result == MessageBoxResult.Yes)
            {
                
            }
        }

        private void BTCLOSE_Click_1(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
